<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>意见反馈</title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/iconfont.css" />
		<link rel="stylesheet" href="css/style.css" />
		<link rel="stylesheet" type="text/css" href="css/member.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">意见反馈</h1>
		</header>
		<div class="mui-content yjfk_con">
			<form action="javascript:;" class="yjfk">
				<div class="bt">请选择要反馈的类型</div>
				<ul class="mui-table-view mui-table-view-radio">
					<li class="mui-table-view-cell mui-selected" id="4">
						<a class="mui-navigate-right">功能异常</a>
					</li>
					<li class="mui-table-view-cell" id="5">
						<a class="mui-navigate-right">意见改进</a>
					</li>
					<li class="mui-table-view-cell" id="4">
						<a class="mui-navigate-right">其他问题</a>
					</li>
				</ul>
				<div class="bt fk_bt">请填写反馈内容</div>
				<div class="yjfk_nr"><textarea id="text" cols="70" rows="4" placeholder="请描述您在使用app的时候遇到的问题和意见"></textarea></div>
			</form>
			<div class="ordpj_btnbox">
				<button type="button" id="btn">提交</button>
			</div>
		</div>
	</body>

</html>
<script src="js/castapp.js"></script>
<script src="js/app.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/layer/layer.min.js"></script>
<script>
	ca.init();
	//选中分类
	var type = 1;
	var list = document.querySelector('.mui-table-view.mui-table-view-radio');
	list.addEventListener('selected', function(e) {
		console.log("当前选中的为：" + e.detail.el.innerText);
		type = e.detail.el.id;
	});
	var btn = ca.id('btn');
	var text = ca.id('text');
	btn.addEventListener('tap', function() {
		var value = text.value;
		if(value == '') {
			ca.prompt('不能为空');
			return;
		}
		//写入数据库
		ca.get({
			//请求的url
			url: APP.api_url + 'member/add_complaint',
			//请求的过程中传递过去的参数 json
			data: {
				uid: getUid(),
				token: get_token(),
				content: value,
				type: type
			},
			//成功了的回调，并且带有返回值
			succFn: function(data) {
				var json = JSON.parse(data);
				if(json.code == 200) {
					layer.msg(json.msg, {
							time: 1000
						},
						function() {
							location.href = 'index.html';
						});
				}
			}
		})

	})
</script>